
/*
 * Java class "Seth.java" generated from Poseidon for UML.
 * Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
 * Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
 */
package jcs;

import java.awt.Color;
import robocode.*;


/**
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7f89]
 */
public class Seth extends AdvancedRobot {

  ///////////////////////////////////////
  // attributes


/**
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7ff0]
 */
    private long ticks; 

   ///////////////////////////////////////
   // associations

/**
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fef]
 */
    public Scanner scanner; 
/**
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fee]
 */
    public Coord coord; 
/**
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fed]
 */
    private Coord currentPos; 
/**
 * <p></p>
 * @poseidon-object-id [sm$a6a21a:ffe8ee1f0d:-7ff0]
 */
    public EnemyList enemyList; 
/**
 * <p></p>
 * @poseidon-object-id [sm$3040c5:ffee75eaf6:-7f86]
 */
    public Driver driver; 
/**
 * <p></p>
 * @poseidon-object-id [sm$3040c5:ffee75eaf6:-7f65]
 */
    public AntiGrav antiGrav; 
/**
 * <p></p>
 * @poseidon-object-id [sm$3cc05f:ffef686712:-7ff5]
 */
    public Gunner gunner; 
/**
 * <p></p>
 * @poseidon-object-id [sm$31b810:ffff82645c:-7fc6]
 */
    public TargetingMode targetingMode; 


  ///////////////////////////////////////
  // operations


/**
 * 
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fec]
 * @return 
 */
    public  Seth() {        
        		ticks = 0;
    } // end Seth        

/**
 * 
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7feb]
 */
    public void run() {        
        		scanner = new Scanner(this);
        		enemyList = new EnemyList(this);
                        driver = new Driver(this);
                        gunner = new Gunner(this);
                        setColors( new Color(90,23,165), new Color(90,23,165), new Color(90,23,165) );
        		while( true )
        		{
        			calcCurrentPos();
        			scanner.doScan();
                                driver.doMove();
                                gunner.doShoot();
        			execute();
        			ticks++;
        		}
    } // end run        

/**
 * 
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fea]
 */
    private void calcCurrentPos() {        
        		if(currentPos == null)
        			currentPos = new Coord(this.getX(), this.getY());
        		else
        			currentPos.setXY(this.getX(), this.getY());
    } // end calcCurrentPos        

/**
 * 
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fe9]
 * @param _currentPos 
 */
    public void setCurrentPos(Coord _currentPos) {        
        		currentPos = _currentPos;
    } // end setCurrentPos        

/**
 * 
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fe8]
 * @return 
 */
    public Coord getCurrentPos() {        
        		return currentPos;
    } // end getCurrentPos        

/**
 * 
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fe7]
 * @param e 
 */
    public void onScannedRobot(ScannedRobotEvent e) {        
        		scanner.scannedRobotEvent(e);
    } // end onScannedRobot        

/**
 * 
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fe6]
 * @param e 
 */
    public void onRobotDeath(RobotDeathEvent e) {        
        		enemyList.remove(e.getName());
                        if(e.getName().equals(gunner.getTargetName()))
                        {
                            gunner.reaquireTarget();
                        }
    } // end onRobotDeath        

/**
 * 
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fe5]
 * @return 
 */
    public long getTicks() {        
        		return ticks;
    } // end getTicks        

/**
 * onHitByBullet: What to do when you're hit by a bullet
 * 
 * @poseidon-object-id [sm$89848d:ffe131bfd5:-7fe4]
 * @param e 
 */
    public void onHitByBullet(HitByBulletEvent e) {        
        // System.out.println("Ouch! I know your using hacks! I'm getting to get you, you hacker!");
        //setTurnLeft(90 - e.getBearing());
    } // end onHitByBullet        

/**
 * <p>Does ...</p>
 * 
 * @poseidon-object-id [sm$a6a21a:ffe8ee1f0d:-7fef]
 * @return 
 */
    public EnemyList getEnemyList() {        
        return enemyList;
    } // end getEnemyList        

/**
 * <p>Does ...</p>
 * 
 * @poseidon-object-id [sm$3cc05f:ffef686712:-7fcc]
 * @param e 
 */
    public void onHitRobot(HitRobotEvent e) {        
        driver.hitRobotEvent(e);
    } // end onHitRobot        

/**
 * <p>Does ...</p>
 * 
 * @poseidon-object-id [sm$aaca8a:ffff2170b8:-7f69]
 * @param e 
 */
    public void onBulletHit(BulletHitEvent e) {        
        gunner.bulletHitEvent(e);
        System.out.println("Hit "+ e.getName());
    } // end onBulletHit        

/**
 * <p>Does ...</p>
 * 
 * @poseidon-object-id [sm$5292e6:100050d2167:-7ff6]
 * @param e 
 */
    public void onHitWall(HitWallEvent e) {        
        driver.hitWallEvent(e);
    } // end onHitWall        

 } // end Seth


